<?php
namespace app\demo\controller;

use app\BaseController;
use app\common\model\mysql\Demo;
use think\exception\HttpException;

class Index extends BaseController{

     public function index(){

         return 123456;
     }

     /*
      * 路由方法
      */
     public function hellow(){

          return time();
     }

     /*
      * mode
      */
     public function demo(){
         $demoObj = new Demo();
         $data = $demoObj->select()->toArray();
         echo "<pre>";
         print_r($data);
         echo "</pre>";
         exit();
     }

    /*
    *不可预知的异常
    */
    public function yichang(){
        //echo $abc;
        throw new \think\exception\HttpException(404, '异常消息');
    }

    /*
     *中间键
     */
    public function middle(){
       echo "<pre>";
       print_r($this->request->type);
       echo "</pre>";
       exit();
    }

}